﻿using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

/// <summary>
/// 人物
/// </summary>
public class Personage {

    /// <summary>
    /// 人物id
    /// </summary>
    public string PersonageId { get; set; }
    /// <summary>
    /// 名
    /// </summary>
    public string FirstName { get; set; }
    /// <summary>
    /// 姓
    /// </summary>
    public string LastName { get; set; }
    /// <summary>
    /// 性别
    /// </summary>
    public Constant.Gender Gender { get; set; }
    /// <summary>
    /// 年龄
    /// </summary>
    public int Age { get; set; }
    /// <summary>
    /// 所属门派
    /// </summary>
    public List<Sect> Sects { get; set; }

    /// <summary>
    /// 生命
    /// </summary>
    public int Hp { get; set; }
    /// <summary>
    /// 最大生命
    /// </summary>
    public int MaxHp { get; set; }
    /// <summary>
    /// 内力
    /// </summary>
    public int Mp { get; set; }
    /// <summary>
    /// 最大内力
    /// </summary>
    public int MaxMp { get; set; }
    /// <summary>
    /// 体力
    /// </summary>
    public int Vit { get; set; }
    /// <summary>
    /// 最大体力
    /// </summary>
    public int MaxVit { get; set; }
    /// <summary>
    /// 等级
    /// </summary>
    public int Grade { get; set; }
    /// <summary>
    /// 经验
    /// </summary>
    public int Exp { get; set; }
    /// <summary>
    /// 下一等级经验
    /// </summary>
    public int MaxExp { get; set; }
    /// <summary>
    /// 人物运气（默认中运）
    /// </summary>
    public Constant.PersonageLuck Luck { get; set; }

    /// <summary>
    /// 自身攻击
    /// </summary>
    public int SelfAttack { get; set; }
    /// <summary>
    /// 当前攻击
    /// </summary>
    public int CurrentAttack { get; set; }
    /// <summary>
    /// 自身防御
    /// </summary>
    public int SelfDefense { get; set; }
    /// <summary>
    /// 当前防御
    /// </summary>
    public int CurrentDefense { get; set; }
    /// <summary>
    /// 自身拳掌
    /// </summary>
    public int SelfFist { get; set; }
    /// <summary>
    /// 当前拳掌
    /// </summary>
    public int CurrentFist { get; set; }
    /// <summary>
    /// 自身腿法
    /// </summary>
    public int SelfLeg { get; set; }
    /// <summary>
    /// 当前腿法
    /// </summary>
    public int CurrentLeg { get; set; }
    /// <summary>
    /// 自身剑法
    /// </summary>
    public int SelfSword { get; set; }
    /// <summary>
    /// 当前剑法
    /// </summary>
    public int CurrentSword { get; set; }
    /// <summary>
    /// 自身刀法
    /// </summary>
    public int SelfKnife { get; set; }
    /// <summary>
    /// 当前刀法
    /// </summary>
    public int CurrentKnife { get; set; }
    /// <summary>
    /// 自身棍法
    /// </summary>
    public int SelfStick { get; set; }
    /// <summary>
    /// 当前棍法
    /// </summary>
    public int CurrentStick { get; set; }
    /// <summary>
    /// 自身毒术
    /// </summary>
    public int SelfPoison { get; set; }
    /// <summary>
    /// 当前毒术
    /// </summary>
    public int CurrentPoison { get; set; }
    /// <summary>
    /// 自身医术
    /// </summary>
    public int SelfLeechcraft { get; set; }
    /// <summary>
    /// 当前医术
    /// </summary>
    public int CurrentLeechcraft { get; set; }

    /// <summary>
    /// 自身力量
    /// </summary>
    public int SelfPower { get; set; }
    /// <summary>
    /// 当前力量
    /// </summary>
    public int CurrentPower { get; set; }
    /// <summary>
    /// 自身身法
    /// </summary>
    public int SelfSpeed { get; set; }
    /// <summary>
    /// 当前身法
    /// </summary>
    public int CurrentSpeed { get; set; }
    /// <summary>
    /// 自身根骨
    /// </summary>
    public int SelfPhysique { get; set; }
    /// <summary>
    /// 当前根骨
    /// </summary>
    public int CurrentPhysique { get; set; }
    /// <summary>
    /// 自身悟性
    /// </summary>
    public int SelfSavvy { get; set; }
    /// <summary>
    /// 当前悟性
    /// </summary>
    public int CurrentSavvy { get; set; }
    /// <summary>
    /// 自身坚韧
    /// </summary>
    public int SelfTenacity { get; set; }
    /// <summary>
    /// 当前坚韧
    /// </summary>
    public int CurrentTenacity { get; set; }
    /// <summary>
    /// 攻击偏好
    /// </summary>
    public Constant.AttackPreference AttPreference { get; set; }
    /// <summary>
    /// 样貌
    /// </summary>
    public int Appearance { get; set; }
    /// <summary>
    /// 道德
    /// </summary>
    public int Morality { get; set; }

    /// <summary>
    /// 天赋
    /// </summary>
    public List<Talent> Talents { get; set; }

    /// <summary>
    /// 装备的物品
    /// </summary>
    public Dictionary<Constant.ArticleCategory, Article> EquipArticles { get; set; }
    /// <summary>
    /// 背包里的物品
    /// </summary>
    public List<ArticleInfo> KnapsackArticles { get; set; }
    /// <summary>
    /// 拥有的武学
    /// </summary>
    public List<PersonageWuxue> OwnWuxues { get; set; }
    /// <summary>
    /// 拥有的攻击武学
    /// </summary>
    public List<PersonageWuxue> AttWuxues { get; set; }
    /// <summary>
    /// 拥有的防御武学
    /// </summary>
    public List<PersonageWuxue> DefWuxues { get; set; }

    #region 战斗相关数据
    public Constant.FightActionCategory FightActionCategory { get; set; }
    /// <summary>
    /// 战斗使用药品
    /// </summary>
    public ArticleInfo FightArticleInfo { get; set; }
    /// <summary>
    /// 攻击目标
    /// </summary>
    public Personage AttackTargetPersonage { get; set; }
    /// <summary>
    /// 攻击武学
    /// </summary>
    public PersonageWuxue AttWuxue { get; set; }
    /// <summary>
    /// 防御武学
    /// </summary>
    public PersonageWuxue DefWuxue { get; set; }
    /// <summary>
    /// 行动速度
    /// </summary>
    public int ActionSpeed { get; set; }
    /// <summary>
    /// 敌方队伍
    /// </summary>
    public List<Personage> EnemyFightTeam { get; set; }
    #endregion

    /// <summary>
    /// 特殊状态
    /// </summary>
    public List<Constant.EffectStatus> Status { get; set; }

    /// <summary>
    /// 初始化角色
    /// </summary>
    public void Init(string lastName, string firstName, Constant.Gender gender = Constant.Gender.Male) {
        this.PersonageId = StringHelper.generateUUID();
        this.FirstName = firstName;
        this.LastName = lastName;
        this.Gender = gender;
        this.Age = 16;
        this.Hp = 100;
        this.MaxHp = 100;
        this.Mp = 100;
        this.MaxMp = 100;
        this.Vit = 100;
        this.MaxVit = 100;
        this.Grade = 0;
        this.Exp = 0;
        this.MaxExp = Constant.ExpLimit[this.Grade];
        this.Luck = Constant.PersonageLuck.Middle;

        System.Random r = GameManager.Instance.Random;
        this.SelfAttack = r.Next(25, 30);
        this.CurrentAttack = this.SelfAttack;
        this.SelfDefense = r.Next(25, 30);
        this.CurrentDefense = this.SelfDefense;
        this.SelfFist = r.Next(25, 30);
        this.CurrentFist = this.SelfFist;
        this.SelfLeg = r.Next(25, 30);
        this.CurrentLeg = this.SelfLeg;
        this.SelfSword = r.Next(25, 30);
        this.CurrentSword = this.SelfSword;
        this.SelfKnife = r.Next(25, 30);
        this.CurrentKnife = this.SelfKnife;
        this.SelfStick = r.Next(25, 30);
        this.CurrentStick = this.SelfStick;
        this.SelfPoison = r.Next(25, 30);
        this.CurrentPoison = this.SelfPoison;
        this.SelfLeechcraft = r.Next(25, 30);
        this.CurrentLeechcraft = this.SelfLeechcraft;

        this.SelfPower = r.Next(25, 30);
        this.CurrentPower = this.SelfPower;
        this.SelfSpeed = r.Next(25, 30);
        this.CurrentSpeed = this.SelfSpeed;
        this.SelfPhysique = r.Next(25, 30);
        this.CurrentPhysique = this.SelfPhysique;
        this.SelfSavvy = r.Next(25, 30);
        this.CurrentSavvy = this.SelfSavvy;
        this.SelfTenacity = r.Next(25, 30);
        this.CurrentTenacity = this.SelfTenacity;

        this.AttPreference = Constant.AttackPreference.Random;
        this.Appearance = r.Next(1, 100);
        this.Morality = 0;

        this.Talents = new List<Talent>();

        this.Status = new List<Constant.EffectStatus>();
        this.EquipArticles = new Dictionary<Constant.ArticleCategory, Article>();
        this.KnapsackArticles = new List<ArticleInfo>();
        for (int i = 0; i < 70; i++) {
            this.KnapsackArticles.Add(new ArticleInfo());
        }
        this.AttWuxues = new List<PersonageWuxue>();
        this.DefWuxues = new List<PersonageWuxue>();
        this.OwnWuxues = new List<PersonageWuxue>();
        PersonageWuxue personageWuxue = new PersonageWuxue("b8101d5cc54d4c4981000a481f79cfa8"); // 基本拳掌
        PersonageWuxue personageWuxue2 = new PersonageWuxue("ac7b9117b2d94ef685465337c31a8ffe"); // 基本招架
        this.DefWuxues.Add(personageWuxue2);
        this.OwnWuxues.Add(personageWuxue);
        this.OwnWuxues.Add(personageWuxue2);
        this.AttWuxues.Add(personageWuxue);
    }

    /// <summary>
    /// 发动攻击，返回受攻击角色的损血量
    /// </summary>
    /// <returns>受攻击角色的损血量</returns>
    public List<int> Attack() {
        List<int> damageList = new List<int>();
        if (this.AttWuxue == null) {
            return damageList;
        }
        WuxueGrade wuxueGrade = this.AttWuxue.GetWuxueGrade();
        Constant.AttackRange attackRange = wuxueGrade.AttRange;
        this.Hp -= wuxueGrade.HpConsume;
        this.Mp -= wuxueGrade.MpConsume;
        this.Vit -= wuxueGrade.VitConsume;
        if (attackRange == Constant.AttackRange.Single) {
            int damage = AttackSingle(this.AttackTargetPersonage);
            damageList.Add(damage);
        } else if (attackRange == Constant.AttackRange.All) {
            foreach (Personage personage in this.EnemyFightTeam) {
                int damage = AttackSingle(personage);
                damageList.Add(damage);
            }
        }
        return damageList;
    }

    private int AttackSingle(Personage enemy) {
        int damage = GetDamage(this, enemy);
        enemy.Hp -= damage;
        if (enemy.Hp < 0) {
            enemy.Hp = 0;
        }
        Debug.Log(string.Format("<color=green>{0}</color>对<color=green>{1}</color>造成了<color=red>{2}</color>点伤害", this.LastName + this.FirstName, enemy.LastName + enemy.FirstName, damage));
        return damage;
    }

    /// <summary>
    /// 获得攻击速度
    /// </summary>
    /// <returns>攻击速度</returns>
    public int GetAttackSpeed() {
        int speed = 0;
        if (this.AttWuxue != null) {
            speed += GameHelper.Multi(AttWuxue.GetWuxueGrade().Speed, Constant.FightWuxueSpeedRatio) + GameHelper.Multi(this.CurrentSpeed, Constant.FightSelfSpeedRatio); // 攻击武学的速度 + 自身速度
        }
        return speed;
    }

    /// <summary>
    /// 获得人物当前战斗攻防以及武学效果
    /// </summary>
    /// <param name="personage">人物</param>
    /// <returns>战斗攻防以及武学效果</returns>
    private Dictionary<string, int> GetCurrentAttDef() {
        Dictionary<string, int> map = new Dictionary<string, int>();
        int attack = 0; // 攻击
        int defense = 0; // 防御
        int vertigo = 0; // 眩晕
        int vertigoChance = 0; // 眩晕概率
        int vertigoResistChance = 0; // 抵抗眩晕概率
        int coma = 0; // 昏迷
        int comaChance = 0; // 昏迷概率
        int comaResistChance = 0; // 抵抗昏迷概率
        int poison = 0; // 中毒
        int poisonChance = 0; // 中毒概率
        int poisonResistChance = 0; // 抵抗中毒概率
        if (this.AttWuxue != null) {
            WuxueGrade wuxueGrade = this.AttWuxue.GetWuxueGrade();
            attack = wuxueGrade.Attack;
            vertigo = wuxueGrade.Vertigo;
            vertigoChance = wuxueGrade.VertigoChance;
            coma = wuxueGrade.Coma;
            comaChance = wuxueGrade.ComaChance;
            poison = wuxueGrade.Poison;
            poisonChance = wuxueGrade.PoisonChance;
        }
        if (this.DefWuxue != null) {
            WuxueGrade wuxueGrade = this.DefWuxue.GetWuxueGrade();
            defense = wuxueGrade.Defense;
            vertigoResistChance = wuxueGrade.VertigoResistChance;
            comaResistChance = wuxueGrade.ComaResistChance;
            poisonResistChance = wuxueGrade.PoisonResistChance;
        }
        if (attack == 0 && defense == 0) { // 没有进行攻击也没有进行防御
            defense = this.CurrentDefense;
        } else if (attack != 0 && defense == 0) { // 全力攻击
            attack += this.CurrentAttack;
            defense = this.CurrentDefense;
        } else if (attack == 0 && defense != 0) { // 全力防御
            defense += this.CurrentDefense;
        } else { // 攻守兼备
            attack = GameHelper.Multi(attack, Constant.ATT_AND_DEF_RATIO) + this.CurrentAttack;
            defense = GameHelper.Multi(defense, Constant.ATT_AND_DEF_RATIO) + this.CurrentDefense;
            vertigo = GameHelper.Multi(vertigo, Constant.ATT_AND_DEF_RATIO);
            vertigoChance = GameHelper.Multi(vertigoChance, Constant.ATT_AND_DEF_RATIO);
            vertigoResistChance = GameHelper.Multi(vertigoResistChance, Constant.ATT_AND_DEF_RATIO);
            coma = GameHelper.Multi(coma, Constant.ATT_AND_DEF_RATIO);
            comaChance = GameHelper.Multi(comaChance, Constant.ATT_AND_DEF_RATIO);
            comaResistChance = GameHelper.Multi(comaResistChance, Constant.ATT_AND_DEF_RATIO);
            poison = GameHelper.Multi(poison, Constant.ATT_AND_DEF_RATIO);
            poisonChance = GameHelper.Multi(poisonChance, Constant.ATT_AND_DEF_RATIO);
            poisonResistChance = GameHelper.Multi(poisonResistChance, Constant.ATT_AND_DEF_RATIO);
        }
        map.Add(Constant.ATTACK, attack);
        map.Add(Constant.DEFENSE, defense);
        map.Add(Constant.VERTIGO, vertigo);
        map.Add(Constant.VERTIGO_CHANCE, vertigoChance);
        map.Add(Constant.VERTIGO_RESIST_CHANCE, vertigoResistChance);
        map.Add(Constant.COMA, coma);
        map.Add(Constant.COMA_CHANCE, comaChance);
        map.Add(Constant.COMA_RESIST_CHANCE, comaResistChance);
        map.Add(Constant.POISON, poison);
        map.Add(Constant.POISON_CHANCE, poisonChance);
        map.Add(Constant.POISON_RESIST_CHANCE, poisonResistChance);
        return map;
    }

    /// <summary>
    /// 得到伤害值
    /// </summary>
    /// <param name="attack">攻击</param>
    /// <param name="defense">防御</param>
    /// <returns>伤害值</returns>
    private int GetDamage(int attack, int defense) {
        int offset = attack - defense;
        System.Random r = GameManager.Instance.Random;
        int damage = attack * 2 - GameHelper.Multi(defense, 1.5);
        Debug.Log("攻击力：" + attack + "，防御力：" + defense + "，造成伤害: " + damage);
        if (offset > 1) { // 差值大于1
            damage += r.Next(1, offset);
        } else if (offset < -1) { // 差值小于-1
            damage += r.Next(offset, -1);
        } else {
            damage += r.Next(1, 10);
        }
        if (damage <= 0) { // 未破防
            damage = r.Next(1, 10);
        }
        return damage;
    }

    /// <summary>
    /// 得到伤害值
    /// </summary>
    /// <param name="attachPersonage">攻击角色</param>
    /// <param name="defensePersonage">防御角色</param>
    /// <returns>伤害值</returns>
    private int GetDamage(Personage attachPersonage, Personage defensePersonage) {
        Dictionary<string, int> attMap = attachPersonage.GetCurrentAttDef();
        Dictionary<string, int> defMap = defensePersonage.GetCurrentAttDef();
        int attack = attMap[Constant.ATTACK];
        int defense = defMap[Constant.DEFENSE];
        return GetDamage(attack, defense);
    }

    /// <summary>
    /// 选择攻击目标
    /// </summary>
    /// <param name="personages">对方的所有人</param>
    public void ChooseAttackTarget() {
        List<Personage> personages = new List<Personage>();
        foreach (Personage personage in this.EnemyFightTeam) {
            if (personage.Hp > 0) {
                personages.Add(personage);
            }
        }
        Constant.AttackPreference attackPreference = this.AttPreference;
        if (attackPreference == Constant.AttackPreference.Beautiful) { // 选择漂亮的
            int index = 0;
            for (int i = 1; i < personages.Count; i++) {
                if (personages[index].Appearance < personages[i].Appearance) {
                    index = i;
                }
            }
            this.AttackTargetPersonage = personages[index];
        } else if (attackPreference == Constant.AttackPreference.Ugly) { // 选择丑陋的
            int index = 0;
            for (int i = 1; i < personages.Count; i++) {
                if (personages[index].Appearance > personages[i].Appearance) {
                    index = i;
                }
            }
            this.AttackTargetPersonage = personages[index];
        } else { // 随机
            System.Random r = GameManager.Instance.Random;
            int index = r.Next(personages.Count);
            this.AttackTargetPersonage = personages[index];
            Debug.Log(string.Format("<color=red>{0}</color> 选择了攻击 <color=red>{1}</color>", (this.LastName + this.FirstName), (this.AttackTargetPersonage.LastName + this.AttackTargetPersonage.FirstName)));
        }
    }

    /// <summary>
    /// 选择战斗武学
    /// </summary>
    public void ChooseFightWuxue() {
        System.Random r = GameManager.Instance.Random;
        int num = r.Next(2); // ****************************************************** 暂时2 ******************************************************
        if (num == 0) { // 主攻（默认第一套攻击武学最弱）
            foreach (PersonageWuxue personageWuxue in this.AttWuxues) {
                if (personageWuxue.Wuxue.ActionCategory == Constant.ActionCategory.Attack) {
                    this.AttWuxue = personageWuxue;
                    break;
                }
            }
        } else if (num == 1) { // 强主攻（默认最后的攻击武学最厉害）
            for (int i = this.AttWuxues.Count - 1; i >= 0; i--) {
                PersonageWuxue personageWuxue = this.AttWuxues[i];
                if (personageWuxue.Wuxue.ActionCategory == Constant.ActionCategory.Attack) {
                    this.AttWuxue = personageWuxue;
                    break;
                }
            }
        } else if (num == 2) { // 攻守兼备
            this.AttWuxue = this.AttWuxues[r.Next(0, this.AttWuxues.Count)];
            this.DefWuxue = this.DefWuxues[r.Next(0, this.DefWuxues.Count)];
        }
        
    }

    /// <summary>
    /// 人物的生命状态码
    /// </summary>
    /// <returns></returns>
    public int GetHpStatusCode() {
        int hp = this.Hp;
        if (hp == 0) { // 死亡
            return 4;
        } else if (hp * 1f / this.MaxHp <= 0.1) { // 濒死状态
            return 3;
        } else if (hp * 1f / this.MaxHp <= 0.25) { // 重伤状态
            return 2;
        } else if (hp * 1f / this.MaxHp <= 0.6) { // 轻伤状态
            return 1;
        } else { // 生命状态正常
            return 0;
        }
    }

    /// <summary>
    /// 人物的生命状态名称，null表示无不良状态
    /// </summary>
    /// <returns></returns>
    public String GetHpStatus() {
        int hpStatusCode = this.GetHpStatusCode();
        string status = null;
        if (hpStatusCode == 1) {
            status = "轻伤";
        } else if (hpStatusCode == 2) {
            status = "重伤";
        } else if (hpStatusCode == 3) {
            status = "濒死";
        } else if (hpStatusCode == 4) {
            status = "死亡";
        }
        return status;
    }

    /// <summary>
    /// 穿上装备
    /// </summary>
    public void PutOnEquipment(Article article) {
        Constant.ArticleCategory articleCategory = article.ArticleTemplet.ArticleCategory;
        //Debug.Log(articleCategory);
        if (articleCategory == Constant.ArticleCategory.Anything // 任何东西
            || articleCategory == Constant.ArticleCategory.QuestItem) { // 任务物品
            // TODO
        } else if (articleCategory == Constant.ArticleCategory.WuxueEsoterica) { // 武学秘籍
            // TODO
        } else if (article.ArticleTemplet.ArticleCategory == Constant.ArticleCategory.Nutriment) { // 营养品
            this.SelfAttack += article.Attack;
            this.SelfDefense += article.Defense;
            this.SelfSpeed += article.Speed;
            this.MaxHp += article.Hp;
            this.Hp += article.Hp;
            this.MaxMp += article.Mp;
            this.Mp += article.Mp;
            this.MaxVit += article.Vit;
            this.Vit += article.Vit;
        } else if (article.ArticleTemplet.ArticleCategory == Constant.ArticleCategory.Drug) { // 药品
            this.RecoverHp(article.Hp);
            this.RecoverMp(article.Mp);
            this.RecoverVit(article.Vit);
        } else { // 装备
            this.CurrentAttack += article.Attack;
            this.CurrentDefense += article.Defense;
            this.CurrentSpeed += article.Speed;
            this.MaxHp += article.Hp;
            this.Hp += article.Hp;
            this.MaxMp += article.Mp;
            this.Mp += article.Mp;
            this.MaxVit += article.Vit;
            this.Vit += article.Vit;
            this.EquipArticles.Add(articleCategory, article);
        }
    }

    /// <summary>
    /// 脱下装备
    /// </summary>
    /// <param name="article"></param>
    public void PutOffEquipment(Article article) {
        this.CurrentAttack -= article.Attack;
        this.CurrentDefense -= article.Defense;
        this.CurrentSpeed -= article.Speed;
        this.MaxHp -= article.Hp;
        if (this.Hp > this.MaxHp) {
            this.Hp = this.MaxHp;
        }
        this.MaxMp -= article.Mp;
        if (this.Mp > this.MaxMp) {
            this.Mp = this.MaxMp;
        }
        this.MaxVit -= article.Vit;
        if (this.Vit > this.MaxVit) {
            this.Vit = this.MaxVit;
        }
        this.Vit -= article.Vit;
        Constant.ArticleCategory articleCategory = article.ArticleTemplet.ArticleCategory;
        if (this.EquipArticles.ContainsKey(articleCategory)) {
            this.EquipArticles.Remove(articleCategory);
        }
    }

    /// <summary>
    /// 恢复生命
    /// </summary>
    /// <param name="hp"></param>
    /// <returns>增加的生命</returns>
    private int RecoverHp(int hp) {
        this.Hp += hp;
        if (this.Hp > this.MaxHp) {
            this.Hp = this.MaxHp;
            return this.MaxHp - this.Hp;
        } else {
            return hp;
        }
    }

    /// <summary>
    /// 恢复内力
    /// </summary>
    /// <param name="mp"></param>
    /// <returns>增加的内力</returns>
    private int RecoverMp(int mp) {
        this.Mp += mp;
        if (this.Mp > this.MaxMp) {
            this.Mp = this.MaxMp;
            return this.MaxMp - this.Mp;
        } else {
            return mp;
        }
    }

    /// <summary>
    /// 恢复体力
    /// </summary>
    /// <param name="vit"></param>
    /// <returns>增加的体力</returns>
    private int RecoverVit(int vit) {
        this.Vit += vit;
        if (this.Vit > this.MaxVit) {
            this.Vit = this.MaxVit;
            return this.MaxVit - this.Vit;
        } else {
            return vit;
        }
    }

    /// <summary>
    /// 休息
    /// </summary>
    public List<int> Rest() {
        List<int> nums = new List<int>();
        int hp = this.RecoverHp(this.MaxHp / 50);
        int mp = this.RecoverMp(this.MaxMp / 50);
        int vit = this.RecoverVit(this.MaxVit / 10);
        nums.Add(hp);
        nums.Add(mp);
        nums.Add(vit);
        return nums;
    }

    /// <summary>
    /// 根据武学分类查询武学
    /// </summary>
    /// <param name="wuxueCategory"></param>
    /// <returns></returns>
    public List<PersonageWuxue> GetWuxuesByCategory(Constant.WuxueCategory wuxueCategory) {
        return this.OwnWuxues.FindAll(p => p.Wuxue.Rely == wuxueCategory);
    }

    /// <summary>
    /// 根据武学行为分类查询武学
    /// </summary>
    /// <param name="actionCategory"></param>
    /// <returns></returns>
    public List<PersonageWuxue> GetWuxuesByCategory(Constant.ActionCategory actionCategory) {
        return this.OwnWuxues.FindAll(p => p.Wuxue.ActionCategory == actionCategory);
    }
}
